JavaScript must be enabled to play.
Browser lacks capabilities required to play.
Upgrade or switch to another browser.
Loading…
<<set $prep to ["baked","dried"]>>\ <<set $flavor to ["apple","banana"]>>\ <<set $form to ["chips","roll"]>>\ <<set $favsnack to $prep.random() + " " + $flavor.random() + " " + $form.random()>>\ <<set $machine to []>><<set $bag to []>>\ <<="Your favorite snack is "+$favsnack+".">> <span id="op">\ <<="Choose an option:">> <<link "Find a snack to buy">>\ <<set $machine to []>>\ <<replace "#op2">>\ <<="Choose a snack to buy:">> <<for _n to 0; _n lt 3; _n++>>\ <<run $machine.push($prep.random() + " " + $flavor.random() + " " + $form.random())>>\ <<link_buy _n $machine[_n]>> <</for>>\ <</replace>>\ <</link>> <<link "Eat a snack">>\ <<if $bag.length gt 0>>\ <<replace "#op2">>\ <<="Choose a snack to eat:">> <<for _n to 0; _n lt $bag.length; _n++>>\ <<link_eat _n $bag[_n]>> <</for>>\ <</replace>>\ <<else>>\ <<replace "#op2">><<="You have no snacks.">><</replace>>\ <</if>>\ <</link>> </span> <span id="op2"></span>
<<widget "link_buy">>\ <<link $args[1] >>\ <<replace "#op2">><<= "You got the "+$args[1]+" from the snack machine.">><</replace>>\ <<run $bag.push($machine[$args[0]])>>\ <</link>>\ <</widget>> <<widget "link_eat">>\ <<link $args[1] >>\ <<replace "#op2">><<= "You eat the "+$args[1]+" and feel better.">><</replace>>\ <<if $args[1] is $favsnack>><<append "#op2">><<= " It is your favorite!">><</append>><</if>>\ <<run $bag.deleteAt($args[0])>>\ <</link>>\ <</widget>>